#  Copyright (c) 2020 - ~, WANGXI
#  
#  GRAMMA CONTROL FLOW TEST TCL FILE
#  Used in NS-2 simulator
#  Clone from https://gitee.com/WangXi_Chn/ns2_modulelib
#  Note in https://www.yuque.com/wangxi_chn/kozrfl
#  
#  Change Logs:
#  Date           Author       Notes			Mail
#  2020-12-04     WangXi   	   first version	WangXi_Chn@foxmail.com

# if-else
set my_planet "earth"
if { $my_planet == "earth" } {
    puts "I feel right at home"
} elseif { $my_planet == "venus" } {
    puts "This is not my home"
} else {
    puts "I am neither from earth, nor from venus"
}

# switch-case
set num_legs 4
switch $num_legs {
    2 {puts "It could be a human"}
    4 {puts "It could be a cow"}
    default {puts "nothing"}
}

# for-loop
for {set i 0} {$i < 5} {incr i 1} {
    puts "In the for loop, and i is $i"
}

# while-loop
set i 0
while {$i < 5} {
    puts "In the while loop, and i is $i"
    incr i 1
}

# foreach-loop
foreach vowel {a e i o u} {
    puts "$vowel is a vowel"
}

#/************************ (C) COPYRIGHT 2020 WANGXI **************END OF FILE****/
